<div class="row">
    <div class="col-md-12 widget-module">
        <div class="box-widget">
            <div class="widget-head clearfix">
                <h4 class="pull-left"><?php echo $this->translate('create user'); ?></h4>
            </div>
            
            <div class="widget-container">
                <div class="widget-block">
                    <div class="widget-content">
                        <form id="usergroup" method="post" class="form-horizontal form-box">
                            <?php if(isset($this->data['id'])): ?>
                                <div class="form-group">
                                    <label class="col-lg-2 control-label"></label>
                                    <div class="col-lg-4">
                                        <div class="alert alert-warning">
                                            <strong><?php echo $this->translate('warning'); ?></strong>
                                            <?php echo $this->translate('no change password'); ?>
                                        </div>
                                    </div>
                                </div>
                            <?php endif; ?>
                            
                            <div class="form-group <?php echo $this->classError['name']; ?>">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('name'); ?></label>
                                <div class="col-lg-4">
                                    <input class="form-control" type="text" value="<?php echo $this->data['name']; ?>" name="name" class="form-control" placeholder="<?php echo $this->translate('name'); ?>" />
                                    <?php echo $this->messageError['name']; ?>
                                </div>
                            </div>
                            
                            <div class="form-group <?php echo $this->classError['username']; ?>">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('username'); ?></label>
                                <div class="col-lg-4">
                                    <input class="form-control" type="text" value="<?php echo $this->data['username']; ?>" name="username" class="form-control" placeholder="<?php echo $this->translate('username'); ?>" />
                                    <?php echo $this->messageError['username']; ?>
                                </div>
                            </div>
                            
                            <div class="form-group <?php echo $this->classError['password']; ?>">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('password'); ?></label>
                                <div class="col-lg-4">
                                    <input class="form-control" type="password" value="" name="password" class="form-control" placeholder="<?php echo $this->translate('password'); ?>" />
                                    <?php echo $this->messageError['password']; ?>
                                </div>
                            </div>
                            
                            <div class="form-group <?php echo $this->classError['repassword']; ?>">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('repassword'); ?></label>
                                <div class="col-lg-4">
                                    <input class="form-control" type="password" value="" name="repassword" class="form-control" placeholder="<?php echo $this->translate('repassword'); ?>" />
                                    <?php echo $this->messageError['repassword']; ?>
                                </div>
                            </div>
                            
                            <div class="form-group <?php echo $this->classError['email']; ?>">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('email'); ?></label>
                                <div class="col-lg-4">
                                    <input class="form-control" type="text" value="<?php echo $this->data['email']; ?>" name="email" class="form-control" placeholder="<?php echo $this->translate('email'); ?>" />
                                    <?php echo $this->messageError['email']; ?>
                                </div>
                            </div>
                            
                            <div class="form-group <?php echo $this->classError['user_group']; ?>">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('user group'); ?></label>
                                <div class="col-lg-4">
                                    <select name="user_group" class="form-control">
                                        <option value="0"><?php echo $this->translate('select'); ?></option>
                                        <?php foreach($this->groups as $group): ?>
                                            <option <?php if(isset($this->data['user_group']) && $this->data['user_group'] == $group->id) echo 'selected="selected"'; ?> value="<?php echo $group->id; ?>"><?php echo $group->group_name; ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                    <?php echo $this->messageError['user_group']; ?>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('status'); ?></label>
                                <div class="col-lg-4">
                                    <div class="checkbox">
                                        <label>
                                            <input <?php if($this->data['status']) echo 'checked="checked"'; ?> type="checkbox" name="status" value="1" />
                                            <?php echo $this->translate('active'); ?>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-lg-2 control-label">&nbsp;</label>
                                <div class="col-lg-4">
                                    <div class="form-actions">
                                        <button type="submit" class="btn btn-primary">
                                            <i class="icon-save"></i>
                                            <?php echo $this->translate('save'); ?>
                                        </button>
                                        <button id="cancel" type="button" class="btn">
                                            <i class="icon-cancel-circle-2"></i>
                                            <?php echo $this->translate('cancel'); ?>
                                        </button>
                                    </div>
                                </div>
                            </div> 
                            <?php if(isset($this->data['id']) && $this->data['id'] > 0): ?>
                            <input type="hidden" name="id" value="<?php echo $this->data['id']; ?>" />
                            <input type="hidden" name="save" value="1" />
                            <?php endif; ?>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
$("#cancel").click(function(){
    window.location = "<?php echo $this->url(array('module' => 'admin', 'controller' => 'user', 'action' => 'index'), null, true); ?>";
});
</script>